#!/usr/bin/env python
# -*- coding: utf-8 -*-

# @Time     :2022/03/21
# @Author   :Changshu
# @File     :Exercise_1143.py

# 1143. 最长公共子序列

def longestCommonSubsequence(self, text1: str, text2: str) -> int:
	m,n=len(text1),len(text2)
	# 行列不要写反了
	dp=[[0 for _ in range(n+1)] for _ in range(m+1)]
	for i in range(m):
		c1=text1[i]
		for j in range(n):
			c2=text2[j]
			if c1==c2:
				dp[i+1][j+1]=dp[i][j]+1
			else:
				dp[i+1][j+1]=max(dp[i][j+1],dp[i+1][j])
	return dp[m][n]

if __name__ == '__main__':
	a=[[0 for _ in range(3)] for _ in range(4)]
	print(a)